package org.example.laboratorymanagement.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.example.laboratorymanagement.pojo.Student;

import java.util.List;

@Mapper
public interface StudentMapper {

    List<Student> listStudents(@Param("username")  String username, @Param("name") String name, @Param("lesson") String lesson);

    void delete(List<Integer> ids);

    void update(Student student);

    @Select("select id,username,name,lesson,password from student where username = #{username} and password = #{password}")
    Student selectByUsernameAndPwd(Student student);

    @Select("select id,username,name,lesson,password from student where id = #{id}")
    Student selectById(Integer id);

//   @Insert("insert into student(username, name, lesson, password) values (#{username},#{name},#{lesson},default)")
    void insert(Student student);

    void insertBatch(@Param("students") List<Student> students);
}
